#include <bit>
#include <iostream>
#include <type_traits>
#include <cstdint>
struct Color {
    uint8_t r, g, b, a;
};

int main() {
    static_assert(sizeof(Color) == sizeof(uint32_t), "Size of Color and uint32_t must be equal");
    static_assert(std::is_trivially_copyable_v<Color>, "Color must be trivially copyable");

    Color color {255, 0, 0, 255}; // 红色，不透明
    auto colorAsInt = std::bit_cast<uint32_t>(color);
    std::cout << "The bit representation of red is: 0x" << std::hex << colorAsInt << std::endl;
    return 0;
}